#include <iostream>
#include <ostream>
//
// Created by lingzhitech on 25-9-26.
//
void fcn3()
{
    size_t v1 = 42; // local variable
    // f can change the value of the variables it captures
    auto f = [v1] () mutable { return ++v1; };
    v1 = 0;
    auto j1 = f(); // j is 43
    std::cout << j1 << std::endl;
    auto j2 = f();
    std::cout << j2 << std::endl;
}

int main() {
    fcn3();
}